package day05;

import java.util.Random;

public class MethodDEmo2 {
	public static void main(String[] args) {
		int a = sum(5,6);
		System.out.println(a);
		
		System.out.println("---------------");
		
		int[] c = generateArray(10,30);
		System.out.println("数组的长度为："+c.length);
		for (int i = 0;i<c.length;i++){
			System.out.println(c[i]);
		}
		
		System.out.println("-----------");
		
		int[] d =generateArray(5,12);
		System.out.println("第一个元素的值："+d[0]);
		for (int i=0;i<d.length;i++){
			System.out.println(d[i]);
		}
		
	}
	public static int sum(int num1,int num2){
		int num = num1+num2;
		return num;
	}
	public static int[] generateArray(int len,int max){
		Random rand = new Random();
		int[] arr = new int[len];
		for (int i=0;i<arr.length;i++){
			arr[i] = rand.nextInt(max+1);
		}
		return arr;
	}
	public static void printArray(int[] arr){
		for (int i=0;i<arr.length;i++){
			System.out.println(arr[i]);
		}
	}
}
